﻿// <copyright file="Surface.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2008-10-24</date>
// <summary>OpenSocial Surface</summary>

namespace opensocial
{
    using System.Diagnostics.CodeAnalysis;
    using System.Windows.Browser;

    /// <summary>
    /// OpenSocial surface
    /// </summary>
    public class Surface
    {
        /// <summary>
        /// Initializes a new instance of the Surface class
        /// </summary>
        /// <param name="scriptObject">the script object</param>
        internal Surface(ScriptObject scriptObject)
        {
            this.ScriptObject = scriptObject;
        }
        
        /// <summary>
        /// Gets or sets the script object
        /// </summary>
        public ScriptObject ScriptObject { get; set; }

        /// <summary>
        /// Returns the name of this surface.
        /// </summary>
        /// <returns>the name of this surface</returns>
        [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", 
            Justification = "Mirroring OpenSocial API."), 
        SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", 
            MessageId = "get", Justification = "Mirroring opensocial API.")]
        public string getName()
        {
            return this.ScriptObject.Invoke("getName") as string;
        }

        /// <summary>
        /// Returns true if the gadget is the primary content on this surface. On a canvas page this is most likely true; on a profile page, it is most likely false.
        /// </summary>
        /// <returns>true if the gadget is the primary content on this surface.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "is", Justification = "Mirroring opensocial API.")]
        public bool isPrimaryContent()
        {
            return (bool) this.ScriptObject.Invoke("isPrimaryContent");
        }
    }
}
